feat(prompt-session): own scan-first rule across CLI and MCP#68
Merged
Conversation
Scan-first enforcement and task lookup were duplicated at the CLI and MCP edges and had drifted: CLI gated on config + FORERUNNER_SCAN_DONE and validated tasks against the registry, while MCP gated unconditionally and validated by prompt-file existence. Introduce a run-scoped PromptSession that owns the single scan-first rule, task lookup (via Task Registry), and bundle resolution, returning a structured Decision. Adapters translate Decisions into exit codes / JSON-RPC and still inject their own scan-satisfied signal, so observable CLI behavior is unchanged. MCP task validation now goes through the registry, so unregistered stray prompt files are rejected. Rationale for unifying the rule but not the signals recorded in docs/adr/0001. Closes #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts the duplicated scan-first enforcement and task lookup from the CLI and MCP adapters into a run-scoped
PromptSession. Closes #49.PromptSessionowns the single scan-first rule, task lookup (via Task Registry), and bundle resolution; returns a structuredDecision(Allowed/Deniedwith aDenialreason enum).scan_satisfiedsignal and translateDecisions into exit codes / JSON-RPC errors.FORERUNNER_SCAN_DONE+ config-gating). Recorded indocs/adr/0001.Behavior change
MCP task validation now goes through the Task Registry instead of prompt-file existence, so unregistered stray prompt files are rejected. Registry ⊆ files is already enforced by tests, so registered tasks are unaffected.
Tests
tests/test_prompt_session.py(TDD tracer → incremental).check; fixed one CLI patch target.🤖 Generated with Claude Code